<?php
/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-05-03 14:41:53
 * @LastEditTime: 2025-05-03 15:23:29
 * @LastEditors: Leequik
 */

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;

class RedisSubscribe extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'redis:RedisSubscribe';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'redis 发布订阅';

    public function __construct()
    {
        parent::__construct();
    }
    /**
     * Execute the console command.
     */
    public function handle()
    {
        //设置永不超时
        ini_set("default_socket_timeout", -1);
        set_time_limit(0);
        
        Redis::subscribe(['quickly.user'], function ($message) {
            echo $message;
        });
    }
}
